﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QuakeStats
{
    class ScoreEntry : LogEntry
    {
        public ScoreEntry(string line) : base(line) { }

        public string ClientId { get; set; }
        public int Score { get; set; }
        public Game DbGame { get; set; }
        
        protected override void ParseLineData(string line)
        {
            // 11:30 score: 429  ping: 12  client: 2 Intrepid Bait
            string justData = line.Trim().Substring(Time.Length).Trim();
            string[] scoreData = justData.Replace("  ", "|").Split('|');

            Score = int.Parse(scoreData[0].Split(':')[1].Trim());
            ClientId = scoreData[2].Split(':')[1].Trim().Split(' ')[0]; //client: 2 Intrepid Bait
        }
    }
}
